package com.ufida.xfire;

import java.net.MalformedURLException;

import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;

import com.mkp.apis.IHelloService;

public class FiCommonServiceFactory {
private static IHelloService service;
	
	public static synchronized IHelloService getInstance() {
		if (service == null) {
			String url = "http://localhost:8080//services/IHelloService";
			Service serviceModel = new ObjectServiceFactory().create(IHelloService.class);
			try {
				service = (IHelloService) new XFireProxyFactory().create(serviceModel, url);
			} catch (MalformedURLException e) {
				e.printStackTrace();
			}
		}
		return service;
	}
}
